package com.chinatsp.onlineapp.presenter;

import com.chinatsp.onlineapp.base.Config;
import com.chinatsp.onlineapp.bean.NewsList;
import com.chinatsp.onlineapp.bean.TitleList;
import com.google.gson.Gson;

import android.content.Context;
import tsp.cn.http.BaseIDao;
import tsp.cn.http.HttpConfig;
import tsp.cn.http.interfac.INetResult;
import tsp.cn.http.tools.LogUtil;
import tsp.cn.http.tools.T;

public class NewsTitleDao extends BaseIDao{
	Context context;
	TitleList list;
	
	public NewsTitleDao(Context context, INetResult iNetResult) {
		super(context, iNetResult);
		 this.context=context;
		
	}

	@Override
	public void onRequestSuccess(String result, int requestCode) {
		
		// LogUtil.v("---开始处理---"+result);
	        //T.showShort(context, result);

	        list = new Gson().fromJson(result, TitleList.class);
	}
	
	public TitleList getList(){
		return this.list;
	}
	
	public void sendUrl(String channelId,int pos,int cnt){
	
        getRequest(new StringBuilder().append(HttpConfig.appendString())  
                	.append(Config.API_NEWS_TITLE)
					.append(channelId)
					.append("/")
					.append(pos)
					.append("/")
					.append(cnt)
					.append("/")
					.toString(), Config.CODE_NEWS_TITLE);
	}

}
